package com.relational.mapping.Service.Impl;

import com.relational.mapping.Model.Teacher;
import com.relational.mapping.Repository.TeacherRepository;
import com.relational.mapping.Service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Csea
 * @title
 * @date 2019/6/11 9:01
 */
@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    private TeacherRepository repository;

    @Override
    public Teacher save(Teacher teacher) {
        return repository.save(teacher);
    }

    @Override
    public Teacher findById(Integer teacherId) {
        return repository.findById(teacherId).orElse(null);
    }

    @Override
    public void deleteById(Integer teacherId) {
        repository.deleteById(teacherId);
    }
}
